package dry.example.controller;

import dry.example.utils.RequestWrapperUtil;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author zc
 */
@RestController
@RequestMapping("user")
public class UserController {

    @PostMapping(path = "any/{name}")
    public Object any(@PathVariable("name") String name, HttpServletRequest request, HttpServletResponse response) {
        String query = request.getQueryString();
        String body = new RequestWrapperUtil(request).getBody();
        System.out.println("query=" + query);
        System.out.println("body=" + body);
        return this.add();
    }

    private Object add() {
        return "add";
    }

}
